package com.otp.service.instance;

import java.util.List;

import org.appfuse.model.Organization;
import org.appfuse.service.GenericManager;

import com.otp.model.test.instance.TestInstance;
import com.otp.model.test.instance.TestInstanceScore;
import com.otp.model.test.instance.TestItemResponseInstance;
import com.otp.model.test.template.TestTemplate;

public interface TestInstanceManager extends GenericManager<TestInstance, Long>{

	TestInstance getTestInstance(String instanceId);
	TestInstance saveTestInstance(TestInstance testInstance);
	void revomeInstance(String testInstanceId);
	public List<TestInstance> getAllTestInstances();
	List<TestInstance> getTestInstanceByUser(String userId,String templateId);
	public List<TestInstance> getTestInstancesByTemplateAndOrganization(String testTemplateId, String orgId);
	public List<TestInstance> getTestInstancesByTemplate(String testTemplateId);
	public List<TestInstance> getTestInstancesByOrganization(String orgId);
	
	public List<TestTemplate> getSubTests(String templateId);
	public TestTemplate fetchTemplate(String templateId);
	public TestTemplate fetchTemplateByName(String name);
	public List<TestTemplate> getTemplateByOrganization(String organizationId);

	public void save(TestInstanceScore testInstanceScore);
	public List<TestInstanceScore> getTestInstanceScore(String testInstanceId); //this list may contain several items
	public TestInstanceScore getSingleTestInstanceScore(String testInstanceId, String testTemplateId); //this list should contain only one item
	
	public List<TestItemResponseInstance> getTestItemResponseInstances(String testInstanceId);
	public List<TestItemResponseInstance> getTestItemResponseInstancesByInstanceIdAndTemplateId(String testInstanceId, String testTemplateId);
	
	public Organization getOrgByName(String orgName);
	public List<Organization> getAllOrganizations();

}
